# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
pkgname=py3-param
pkgver=2.1.0
pkgrel=1
pkgdesc="Make your Python code clearer and more reliable by declaring Parameters"
url="https://github.com/holoviz/param"
arch="noarch"
license="BSD-3-Clause"
depends="python3"
makedepends="py3-gpep517 py3-hatchling py3-hatch-vcs py3-wheel"
checkdepends="py3-pytest-asyncio py3-pytest-cov py3-flake8"
subpackages="$pkgname-doc $pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/holoviz/param/archive/v$pkgver/param-$pkgver.tar.gz"
builddir="$srcdir/param-$pkgver"

case "$CARCH" in
# several test fails on two architectures | skip for now
ppc64le | riscv64) options="$options !check" ;;
esac

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -k 'not testreactive.py' --ignore=tests/testjsonserialization.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	install -Dm644 ./*.md -t "$pkgdir"/usr/share/doc/$pkgname
}

sha512sums="
2d0308297af4459c272f0276972166a8430349f8ca01c0eededc8b20f9224223adfd07dd57d374ce6c13b8e1db06f250c8ec0b30cafdca500bf135a3768cfa17  py3-param-2.1.0.tar.gz
"
